﻿using System;
using System.Web.Mvc;

namespace Nasa8x.Mvc
{
    public class BiaControllerFactory : DefaultControllerFactory
    {
        public override IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
        {
            try
            {
                return base.CreateController(requestContext, controllerName);
            }
            catch (Exception ex)
            {
                requestContext.RouteData.Values["id"] = controllerName;

                controllerName = "DynamicPage";
                requestContext.RouteData.Values["controller"] = controllerName;
                return base.CreateController(requestContext, controllerName);
            }
        }
    }
}
